package com.ruoyi.video.view;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.Apps.Utils.AppUtils;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.social.domain.SocialVideo;
import com.ruoyi.video.Enum.AnalysisStatusEnum;
import com.ruoyi.video.domain.VideoImages;
import com.ruoyi.video.domain.VideoLineItem;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 视频解析对象 video_analysis
 * 
 * @author ruoyi
 * @date 2025-03-07
 */
public class VideoAnalysisView
{
    private static final long serialVersionUID = 1L;

    /** ID */
    @Excel(name = "ID")
    private String id;

    /** 视频内部编号 */
    private String videoNo;

    /** 视频链接 */
    @Excel(name = "视频链接")
    private String videoLink;

    /** 平台 */
    @Excel(name = "平台")
    private String postPlatform;

    /** 发布日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "发布日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date videoDate;


    /** 视频封面 */
    private String videoCover;

    /** 视频时长（秒） */
    private Long videoTime;

    // ---------------- 解析相关 ----------------
    /** 状态（解析/发布） */
    @Excel(name = "状态")
    private String status;

    /** 解析时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date workTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date postLastUpdateData;

    /** 错误信息 */
    private String errmsg;

    /** MP4/MP3 存储路径 */
    private String mp4Path;

    /** 语言 */
    private String language;

    private String translateLanguage;

    // ---------------- 社交指标 ----------------
    @Excel(name = "播放量")
    private Long videoViews;

    @Excel(name = "点赞量")
    private Long likes;

    @Excel(name = "评论量")
    private Long comments;

    @Excel(name = "分享量")
    private Long shares;

    @Excel(name = "收藏量")
    private Long saves;

    @Excel(name = "gmv($)")
    private BigDecimal gmvUsd;

    // ---------------- 脚本信息 ----------------
    @Excel(name = "脚本摘要")
    private String scriptSummaryOrigin;

    /** 视频截图 */
    private List<VideoImages> videoImages;

    private List<VideoLineItem> videoLineItems;

    public VideoAnalysisView(SocialVideo socialVideo) {
        if (socialVideo != null) {
            // 使用 Spring BeanUtils 复制同名属性
            BeanUtils.copyProperties(socialVideo, this);
            setId(AppUtils.getSystemOutId(socialVideo.getId()));
            if (StringUtils.isNotNull(socialVideo.getUser())) {
                setTranslateLanguage(socialVideo.getUser().getTranslateLanguage());
            }
            setMp4Path(null);
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getVideoNo() {
        return videoNo;
    }

    public void setVideoNo(String videoNo) {
        this.videoNo = videoNo;
    }

    public String getVideoLink() {
        return videoLink;
    }

    public void setVideoLink(String videoLink) {
        this.videoLink = videoLink;
    }

    public String getPostPlatform() {
        return postPlatform;
    }

    public void setPostPlatform(String postPlatform) {
        this.postPlatform = postPlatform;
    }

    public Date getVideoDate() {
        return videoDate;
    }

    public void setVideoDate(Date videoDate) {
        this.videoDate = videoDate;
    }

    public String getVideoCover() {
        return videoCover;
    }

    public void setVideoCover(String videoCover) {
        this.videoCover = videoCover;
    }

    public Long getVideoTime() {
        return videoTime;
    }

    public void setVideoTime(Long videoTime) {
        this.videoTime = videoTime;
    }

    public String getStatus() {
        return StringUtils.isNotEmpty(status)? status: AnalysisStatusEnum.NONE.toString();
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Date getWorkTime() {
        return workTime;
    }

    public void setWorkTime(Date workTime) {
        this.workTime = workTime;
    }

    public String getErrmsg() {
        return errmsg;
    }

    public void setErrmsg(String errmsg) {
        this.errmsg = errmsg;
    }

    public String getMp4Path() {
        return mp4Path;
    }

    public void setMp4Path(String mp4Path) {
        this.mp4Path = mp4Path;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    public Long getVideoViews() {
        return videoViews;
    }

    public void setVideoViews(Long videoViews) {
        this.videoViews = videoViews;
    }

    public Long getLikes() {
        return likes;
    }

    public void setLikes(Long likes) {
        this.likes = likes;
    }

    public Long getComments() {
        return comments;
    }

    public void setComments(Long comments) {
        this.comments = comments;
    }

    public Long getShares() {
        return shares;
    }

    public void setShares(Long shares) {
        this.shares = shares;
    }

    public Long getSaves() {
        return saves;
    }

    public void setSaves(Long saves) {
        this.saves = saves;
    }

    public BigDecimal getGmvUsd() {
        return gmvUsd;
    }

    public void setGmvUsd(BigDecimal gmvUsd) {
        this.gmvUsd = gmvUsd;
    }

    public String getScriptSummaryOrigin() {
        return scriptSummaryOrigin;
    }

    public void setScriptSummaryOrigin(String scriptSummaryOrigin) {
        this.scriptSummaryOrigin = scriptSummaryOrigin;
    }

    public Date getPostLastUpdateData() {
        return postLastUpdateData;
    }

    public void setPostLastUpdateData(Date postLastUpdateData) {
        this.postLastUpdateData = postLastUpdateData;
    }

    public List<VideoImages> getVideoImages() {
        return videoImages;
    }

    public void setVideoImages(List<VideoImages> videoImages) {
        this.videoImages = videoImages;
    }

    public List<VideoLineItem> getVideoLineItems() {
        return videoLineItems;
    }

    public void setVideoLineItems(List<VideoLineItem> videoLineItems) {
        this.videoLineItems = videoLineItems;
    }

    public String getTranslateLanguage() {
        return translateLanguage;
    }

    public void setTranslateLanguage(String translateLanguage) {
        this.translateLanguage = translateLanguage;
    }
}
